package wang.Demo;

import java.util.Scanner;

public class TicketDemo1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int moon;
        String ticket;
        System.out.println("请问您想要购买几月份的机票 ");
        moon= sc.nextInt();
        System.out.println("请问您想要购买头等舱还是经济舱 ");
        ticket = sc.next();
        System.out.println("您的票价是 " + AriTicket(moon , ticket));

    }
    public static double AriTicket(int a , String b){
        double money=1000;
        double money2=100;
        double money3=0;
        if(a>=5 && a<=10){
            switch (b){
                case "头等舱" :
                    money3=money * 0.9;
                    break;
                case "经济舱" :
                    money3 = money2 * 0.85;
                    break;
                case null, default:
                    System.out.println("您输入的类型有误，请重新输入");
            }

        }
        if (a<5 || a>10){
            switch (b){
                case "头等舱":
                    money3 = money * 0.7;
                    break;
                case "经济舱":
                    money3 = money2 * 0.65;
                    break;
                case null, default:
                    System.out.println("您输入的类型有误，请重新输入 ");
            }
        }
        return money3;
    }
}
